
import javax.swing.JOptionPane;

public class MyWork03
{
    public static void main(String[] args)
    {
        String str=new String();
	int n,m;

        if(args.length==0)
	{
	  String out="Please input two Integers and using \",\"to split them";  
	  out=JOptionPane.showInputDialog(null,out);  
 	  String[] mystr=out.split(",");  
 	  n=Integer.parseInt(mystr[0]);
	  m=Integer.parseInt(mystr[1]);
	}

	else
	{
     	  n=Integer.parseInt(args[0]);
          m=Integer.parseInt(args[1]);
	}
	int count=0;

	for(int j=n;j<=m;j=j+1)
	{
	    if(isPrimeNumber(j))
      {
        str=str+j+" ";
        count++;
        if (count!=0&&count%5==0)
          str=str+"\n";
      }



        }
	String str1="the prime numbers are following";
	JOptionPane.showMessageDialog(null,str1+"\n\n"+str,"prime number",1);  
}

    static boolean isPrimeNumber(int k){
            if(k==0||k==1)
                    return false;
            if(k==2||k==3)
                    return true;
            for(int i=2;i<k;i++)
                    if(k%i==0)
                        return false;
            return true;
        }
}

